package org.projectback.utils;

import com.alibaba.fastjson2.JSONObject;

import org.springframework.stereotype.Component;

@Component
public class Utils {
    public String objectToJsonString(Object object) {
        return JSONObject.toJSONString(object);
    }

    public Object jsonStringToObject(String jsonString, Class<?> clazz) {
        return JSONObject.parseObject(jsonString, clazz);
    }

    public void say() {
        System.out.println("hello");
    }

    public String[] splitFileName(String fileName) {
        if (fileName == null || fileName.isEmpty()) {
            return null;
        }
        return fileName.split("\\.(?=[^.]+$)");
    }
}
